<template>
    <el-submenu :index="menu.menuId + ''">
        <template slot="title">
            <span>{{ menu.name }}</span>
        </template>

        <el-menu-item-group>
            <el-menu-item
                v-for="item in menu.list"
                :key="item.menuId + ''"
                :index="item.menuId + ''"
                @click="gotoRouteHandle(item)"
            >
                <span>{{ item.name }}</span>
            </el-menu-item>
        </el-menu-item-group>
    </el-submenu>
</template>

<script>
import SubMenu from './sub-menu';
export default {
    name: 'sub-menu',
    props: {
        menu: {
            type: Object,
            required: true,
        },
    },
    components: {
        SubMenu,
    },
    computed: {},
    methods: {
        // 通过menuId与动态(菜单)路由进行匹配跳转至指定路由
        gotoRouteHandle(menu) {
            this.$router.push({
                name: menu.path,
            });
        },
    },
};
</script>

<style scoped></style>
